<template>
	<view>

		<view class="item">
			<view class="item-conten">
				<text>持卡人:</text>
				<input type="text" v-model="bankName" placeholder="持卡人" />
			</view>
			<view class="item-conten">
				<text>卡号:</text>
				<input type="text" v-model="bankCode" placeholder="持卡人本人银行卡卡号" />
				<!-- <image class="image" src="../../../static/iamge-bank.png"></image> -->
			</view>
		</view><!-- @click="gotoPath('/pages/user/add-bankCard/fill-mcg/fill-mcg') -->
		<view class="next" @click="addNext">
			下一步
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bankCode: '',
				bankName: '',
			};
		},
		methods: {
			addNext() {
				let self = this;
				let bankmsg = {};
				if (self.bankName == '') {
					uni.showToast({
						title: '请输入持卡人姓名！',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				var pattern = /^([1-9]{1})(\d{14}|\d{18})$/;
				if (!pattern.test(self.bankCode)) {
					uni.showToast({
						title: '银行卡有误,请重新输入！',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				bankmsg.bankName = self.bankName;
				bankmsg.bankCode = self.bankCode;
				
				// let formData ={};
				// formData.bankName = self.bankName,
				// formData.bankCode = self.bankCode,
				// formData.bankPhone = '18278147471',
				// console.log(formData)
				
				// self._post(
				// 	'user.add/add_bank',
				// 	formData,
				// 	result => {
				// 		console.log(result.code);
				// 		if (result.code == 1) {
				// 			uni.showToast({
				// 				title: '添加成功！',
				// 				duration: 2000,
				// 				icon: 'none'
				// 			});
				// 			//self.gotoPage('/pages/user/my-account/bank-card/bank-card');
				// 		}
				// 	},
				// 	false,
				// 	() => {
				// 		uni.hideLoading();
				// 	}
				// )
				// uni.showLoading({
				// 	title: '正在提交',
				// });
				// self._post(
				// 	'user.add/add_bank',
				// 	formData,				
				// 	result => {
				// 		console.log(result.code);
				// 		if (result.code == 1) {
				// 			uni.showToast({
				// 				title: '添加成功！',
				// 				duration: 2000,
				// 				icon: 'none'
				// 			});
				// 			self.gotoPage('/pages/user/my-account/bank-card/bank-card');
				// 		}
				// 	},
				// 	false,
				// 	() => {
				// 		uni.hideLoading();
				// 	}
				// )
				// console.log(bankmsg);
				// //let bank = bankmsg;
				let bank = JSON.stringify(bankmsg)
				uni.navigateTo({
					url: '/pages/user/add-bankCard/fill-mcg/fill-mcg?select=1&&bank=' + bank,
				})
			},
		}
	}
</script>

<style lang="scss">
	.item {
		display: flex;
		flex-direction: column;
	}

	.item-conten {
		width: 90%;
		height: 120rpx;
		line-height: 120rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		align-items: center;
		border-bottom: 2rpx solid #f4f4f4;
	}

	.item-conten text {
		font-size: 30rpx;

	}

	.item-conten input {
		font-size: 30rpx;
		margin-left: 40rpx;
	}

	.image {
		width: 80rpx;
		height: 60rpx;
		display: block;
		margin-left: 120rpx;
	}

	.next {
		width: 90%;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		margin: 120rpx auto 0;
		background-color: rgba(88, 100, 253, 1);
		border-radius: 8rpx;
		color: #FFFFFF;
	}
</style>
